import React, { Component } from 'react';
import { Col, Row } from 'antd';
import styles from './index.less';

export interface TitleProps {
    label?: string; // 显示的文字
    rightCbk?: () => any; // 右边显示数据
    code?: string; // id
}

export default class Title extends Component<TitleProps, any> {
    render() {
        const { label, rightCbk } = this.props;
        return (
            <Row>
                <Col span={rightCbk ? 18: 24}>
                <div className={styles.title}>
                    <span className={styles.info}>{label == 'null' ? '未命名' : label}</span>
                </div>
            </Col>
                { rightCbk
                    ? <Col
                        span={6}>
                        <div
                            className={styles.title}>
                            {rightCbk()}
                        </div>
                </Col> : null}
            </Row>
        )
    }
}
